import React from 'react'
import axios from 'axios'
export default function App() {
  var getStudent = ()=>{
    axios.get('http://localhost:3000/students').then(
     response => {console.log('数据获取成功',response.data)},
     error => {console.log('数据获取失败',error)}
    )
  }

  // var getCar = ()=>{
  //   axios.get('http://localhost:5001/cars').then(
  //    response => {console.log('数据获取成功',response.data)},
  //    error => {console.log('数据获取失败',error)}
  //   )
  // }
  return (
    <div>
      <button onClick={getStudent}>点击获取学生数据</button>
      <button onClick={getStudent}>获取汽车数据</button>
    </div>
    
  )
}
